<template>
	<flexbox>
		<el-input
			v-model="dataValue.val"
			:type="type"
			:disabled="disabled"
			:placeholder="item.placeholder"
			@input="valueChange"
		></el-input>
		<el-select
			v-model="dataValue.unit"
			style="flex: 0 1 70px;margin-left: 10px;"
			@change="valueChange"
			:disabled="disabled"
		>
			<el-option
				v-for="unit in item.units"
				:value="unit.value"
				:label="unit.name"
				:key="unit.value"
			></el-option>
		</el-select>
	</flexbox>
</template>
<script type="text/javascript">
import objMixin from './objMixin'

export default {
	name: 'xh-input-unit', // 新建 input
	components: {},
	mixins: [objMixin],
	computed: {
		type() {
			if (this.item && this.item.form_type == 'password') {
				return this.item.form_type
			} else {
				return 'text'
			}
		}
	},
	watch: {},
	data() {
		return {}
	},
	props: {},
	mounted() {},
	methods: {
		valueChange() {
			this.$emit('value-change', {
				item: this.item,
				index: this.index,
				value: this.dataValue
			})
		}
	}
}
</script>
<style lang="scss" scoped></style>
